package com.oa.xinxi.biz;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.oa.xinxi.dao.LeaderSpeechMapper;
import com.oa.xinxi.entity.LeaderSpeech;

@Service
public class SpeechBiz {
	@Resource
	private LeaderSpeechMapper mapper;
	public void save(LeaderSpeech speech) {
		speech.setCreatetime(new Date());
		mapper.insert(speech);
	}
	public void deleteById(int id) {
		mapper.deleteByPrimaryKey(id);
	}
	public void update(LeaderSpeech speech) {
		speech.setUpdatetime(new Date());
		LeaderSpeech speech2 = mapper.selectByPrimaryKey(speech.getSpeechId());
		speech.setCreatetime(speech2.getCreatetime());
		speech.setCreator(speech2.getCreator());
		mapper.updateByPrimaryKeySelective(speech);
	}
	public LeaderSpeech findById(Integer id) {
		return mapper.selectByPrimaryKey(id);
	}
	public List<LeaderSpeech> findAll() {
		return mapper.findAll();
	}
}
